<html>
<body>
  //Hello Edit
<?php
function hex_color($max_r,$max_g,$max_b){
	// ensure that values are in the range between 0 and 255
	if ($max_r > 255) { $max_r = 255; }
	if ($max_g > 255) { $max_g = 255; }
	if ($max_b > 255) { $max_b = 255; }
	if ($max_r < 0) { $max_r = 0; }
	if ($max_g < 0) { $max_g = 0; }
	if ($max_b < 0) { $max_b = 0; }
	$max_r = dechex($max_r);
	$max_g = dechex($max_g);
	$max_b = dechex($max_b);
	if(strlen($max_r) == 1) { $max_r = '0'.$max_r; }
	if(strlen($max_g) == 1) { $max_g = '0'.$max_g; }
	if(strlen($max_b) == 1) { $max_b = '0'.$max_b; }
	return ($max_r) . ($max_g) . ($max_b);}

function Shades_color($col = array(),$tone = array(),$numrow,$numcol){
	$tempcol = $col;
	for($i = 0; $i < (255/$numrow)+1; $i=$i+1){
		echo '<tr>';
		for($j = 0; $j < (255/$numcol)+1; $j=$j+1){
			$hex = hex_color($tempcol["r"],$tempcol["g"],$tempcol["b"]);
			echo '<td bgcolor="#' . $hex . '">#' . $hex . '</td>';
			$tempcol["r"] = $tempcol["r"] + $numcol;
			$tempcol["g"] = $tempcol["g"] + $numcol;
			$tempcol["b"] = $tempcol["b"] + $numcol;
		}
		$col["r"] = $col["r"] + $tone["r"];
		$col["g"] = $col["g"] + $tone["g"];
		$col["b"] = $col["b"] + $tone["b"];
		$tempcol = $col;
		echo'</tr>';
	}
	return $col;
}

$tone_color_row = 17;
$tone_color_col = 17;
$color = array( "r" => 0,"g" => 0,"b" => 0);
$shades_color = array(	//Black defult
						0 => array("r"=> $tone_color_row,"g" => 0,"b" => 0),	//Red
						1 => array("r"=> 0,"g" => 0,"b" => $tone_color_row),	//Violet
						2 => array("r"=> -$tone_color_row,"g" => 0,"b" => 0),	//Blue
						3 => array("r"=> 0,"g" => $tone_color_row,"b" => 0),	//SkyBlue
						4 => array("r"=> 0,"g" => 0,"b" => -$tone_color_row),	//Green
						5 => array("r"=> $tone_color_row,"g" => 0,"b" => 0),	//Yellow
						6 => array("r"=> 0,"g" => -$tone_color_row,"b" => 0),	//Orange
						7 => array("r"=> 0,"g" => $tone_color_row,"b" => $tone_color_row)	//White
);

echo'<table>' . "\n";
	for($i=0;$i<8;$i=$i+1){
		$color = Shades_color($color,$shades_color[$i],$tone_color_row,$tone_color_col);
	}
echo'</table>';

?>
</body>
</html>
